﻿[assembly: System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.Additions.Dependant.js", "application/x-javascript")]
[assembly: System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.Additions.Dependant.debug.js", "application/x-javascript")]

namespace BM.Tools.WebControls.MForm.Controls.Additions
{    
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Web.UI;

    using AjaxControlToolkit;

    using BM.Tools.WebControls.MForm.Controls.Additions.Actions;
    using Helper;
    
    /// <summary>
    /// The dependant is a data container that is inside the Determinancy control. 
    /// </summary>
    [ClientScriptResource("BM.Tools.WebControls.MForm", "BM.Tools.WebControls.MForm.Controls.Additions.Dependant.js")]
    [ParseChildren(true, "Actions")]
    public class Dependant
    {
        private Collection<Action> actions = new Collection<Action>();

        /// <summary>
        /// Initializes a new instance of the <see cref="Dependant"/> class. 
        /// </summary>
        public Dependant()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Dependant"/> class. 
        /// </summary>
        /// <param name="path">
        /// The path of the dependant.
        /// </param>
        public Dependant(string path)
        {
            Path = path;
        }

        /// <summary>
        /// Gets or sets Path.
        /// </summary>
        /// <value>
        /// The path of the Dependant.
        /// </value>
        public string Path
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the actions.
        /// </summary>                
        [TypeConverter(typeof(JsonConverter))]
        [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
        public Collection<Action> Actions
        {
            get
            {
                return actions;
            }
        }
    }
}